/*
*********************************************************************************************************
*                                         uC/OS-II ON MINI2440 BOARD
                                                ARM920T Port
*                                             ADS v1.2 Compiler
*                               (c) Copyright 2011,ZhenGuo Yao,ChengDu,Uestc
*                                           All Rights Reserved
*
* File : 2440lib.h
* By   : ZhenGuoYao
*Modified by:Zhao Hongxu
*********************************************************************************************************
*/

#ifndef __SERIAL_H__
#define __SERIAL_H__

#define min(x1,x2) (((x1)<(x2))? (x1):(x2))
#define max(x1,x2) (((x1)>(x2))? (x1):(x2))

#define ONESEC0 (62500)              //16us resolution, max 1.04 sec
#define ONESEC1 (31250)              //32us resolution, max 2.09 sec
#define ONESEC2 (15625)              //64us resolution, max 4.19 sec
#define ONESEC3 (7812)               //128us resolution, max 8.38 sec
#define ONESEC4 (PCLK/128/(0xff+1))  //@60Mhz, 128*4us resolution, max 32.53 sec

#define REQCNT 30
#define ADCPRS 9
#define LOOP 1

#define EnterPWDN(clkcon) ((void (*)(int))0x20)(clkcon)


void Uart_Init(void);
void Uart_TxEmpty(int ch);
char Uart_Getch(void);
unsigned char Uart_Getc(void);
unsigned char Uart_Getcs(void);


char Uart_GetKey(void);
void Uart_GetString(char *string);


void Uart_SendByte(int data);
void Uart_SendString(char *pt);

#endif  //__2440lib_h__
